package cn.edu.wfu.libautobook.mapper;

import cn.edu.wfu.libautobook.bean.Schedule;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ScheduleMapper extends BaseMapper<Schedule> {
    @Select("SELECT * FROM wfu_shadule WHERE sid = #{sid}")
    @Results(
            {
                    @Result(column = "user", property = "user" , one = @One(select = "cn.edu.wfu.libautobook.mapper.UserMapper.selectById")),
                    @Result(column = "jid", property = "quartz", one = @One(select = "cn.edu.wfu.libautobook.mapper.QuartzMapper.selectById"))
            }
    )
    Schedule getScheduleBySid(Integer sid);

    @Select("SELECT * FROM wfu_shadule WHERE user = #{uid}")
    @Results(
            {
                    @Result(column = "user", property = "user" , one = @One(select = "cn.edu.wfu.libautobook.mapper.UserMapper.selectById")),
                    @Result(column = "jid", property = "quartz", one = @One(select = "cn.edu.wfu.libautobook.mapper.QuartzMapper.selectById"))
            }
    )
    List<Schedule> getScheduleListByUid(Integer uid);
}
